﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;
using EHTWebsiteProject.Code.Entity;
using EHTWebsite.Code;

namespace EHTWebsiteProject.Code.Utility
{
    public class Config
    {
        public static String TinTucDetails(ParaNews theParaNews, TinTuc theTinTuc, String CSSClass, Boolean IsVN)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("<div class='"+CSSClass+"'>");
            sb.Append("<div style='float:left; padding-right:5px'>");
            if (theParaNews.DisplayImage.Trim() == HangSo.True)
            {
                sb.Append(" <img ID='imageNews' src='../ImageDatas/News/" + theTinTuc.HinhAnhUrl.Trim() + "' runat='server' />");
            }
            else if (theParaNews.DisplayImage.Trim() == HangSo.False)
            {
                sb.Append(" ");
            }

            sb.Append("</div>");
            sb.Append("<div style='float:inherit;'>");
            if (IsVN == true)
            {
                String Date = String.Format("{0:d/M/yyyy}", theTinTuc.NgayTao);
                if (theParaNews.ShowArticle.Trim() == HangSo.True)
                {
                    sb.Append("<b>" + theTinTuc.TieuDeVN + "</b> <i>(" + Date + ")</i><br/>");
                }
                else
                    sb.Append("<br/>");
                sb.Append(theTinTuc.TomTatVN + "<br/>");
            }
            else
            {
                String Date = String.Format("{0:d/M/yyyy}", theTinTuc.NgayTao);
                sb.Append("<b>" + theTinTuc.TieuDeOther + "</b> <i>(" + Date + ")</i><br/>");
                sb.Append(theTinTuc.TomTatOther+"<br/>");
            }
           
            if (IsVN == true)
            {
                sb.Append(theTinTuc.NoiDungVN );
            }
            else
            {
                sb.Append(theTinTuc.NoiDungOther);
            }

            sb.Append("</div>");
            sb.Append("</div>");
            return sb.ToString();
        }
        /// <summary>
        /// Ham view san pham chi tiet khong co gio hang
        /// </summary>
        /// <returns></returns>
        public static String SanPhamDetails(SanPham theSanPham, ParaProducts theParaProducts, String CssClass, Boolean IsVN)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("<table cellpadding='0' cellspacing='0' width='100%'>");

            sb.Append("<tr>");

            sb.Append("<td style='width:35%'>");
            if (theParaProducts.DisplayImg.Trim() == HangSo.True)
            {
                sb.Append("<div class='" + CssClass + "'>");
                sb.Append(" <img ID='imageNews' src='../ImageDatas/Products/" + theSanPham.HinhAnhUrl.Trim() + "' runat='server' />");
                sb.Append("</div>");
            }
            else
            {
                sb.Append(" ");
            }
            sb.Append("<td>");

            sb.Append("<td>");

            sb.Append("<table  cellpadding='0' cellspacing='0'>");

            sb.Append("<tr>");
            sb.Append("<td style='width:30%'>");            
            sb.Append("<b>Sku</b>");
            sb.Append("</td>");
          
            sb.Append("<td>");
            sb.Append(theSanPham.MaSku);
            sb.Append("</td>");
            sb.Append("</tr>");

            sb.Append("<tr>");
            sb.Append("<td>");
            if (IsVN == true)
                sb.Append("<b>Tên sản phẩm</b>");
            else
                sb.Append("<b>Product Name</b>");
            sb.Append("</td>");
            sb.Append("<td>");
            if (theParaProducts.ShowArticle.Trim() == HangSo.True)
            {
                if (IsVN == true)
                    sb.Append( theSanPham.TenSanPhamVN );
                else
                    sb.Append(theSanPham.TenSanPhamOther );
            }
            else
                sb.Append("");
            sb.Append("</td>");
            sb.Append("</tr>");

            sb.Append("<tr>");
            sb.Append("<td>");
            if (IsVN == true)
                sb.Append("<b>Giá</b>");
            else
                sb.Append("<b>Price</b>");
            sb.Append("</td>");
            sb.Append("<td>");
            if (theParaProducts.DisplayPrice.Trim() == HangSo.True)
            {
                if (IsVN == true)
                    sb.Append(theSanPham.DonGia);
                else
                    sb.Append(theSanPham.DonGia);
            }
            else
                sb.Append("");
            sb.Append("</td>");
            sb.Append("</tr>");

            sb.Append("<tr>");
            sb.Append("<td>");
            if (IsVN == true)
                sb.Append("<b>Mô tả</b>");
            else
                sb.Append("<b>Description</b>");
            sb.Append("</td>");
            sb.Append("<td>");            
                if (IsVN == true)
                    sb.Append(theSanPham.NoiDungVN);
                else
                    sb.Append(theSanPham.NoiDungOther);           
            sb.Append("</td>");
            sb.Append("</tr>");

            sb.Append("</table>");

            sb.Append("<td>");

            sb.Append("</tr>");

            sb.Append("</table>");
                       
            return sb.ToString();
        }

        /// <summary>
        /// Ham view san pham chi tiet co gio  hang
        /// </summary>
        /// <returns></returns>
        public static String SanPhamCartDetails()
        {
            StringBuilder sb = new StringBuilder();
            return sb.ToString();
        }
    }
}